package observerPattern;

public class ObserverPatternMain {

    public static void main(String[] args) {
        ConcreteSubject cSubject = new ConcreteSubject();

        Observer o1 = new ObserverUser("zhang san");
        Observer o2 = new ObserverUser("Li Si");
        Observer o3 = new ObserverUser("Wang Wu");
        Observer o4 = new ObserverUser("Ma Liu");

        cSubject.attach(o1);
        cSubject.attach(o2);
        cSubject.attach(o3);
        cSubject.attach(o4);

        cSubject.notify("Publish News 1st");

        cSubject.detach(o4);

        cSubject.notify("Publish News 2nd");

    }
}
